package com.example.threadpool2.utils;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @author zhuyonggang
 * @DateTime: 2021/8/31 17:42
 */
public class ThreadPoolCreate {
    private static ThreadPoolExecutor threadPoolExecutor = null;

    public static ThreadPoolExecutor getThreadPoolExecutor() {
        if (threadPoolExecutor == null) {
            threadPoolExecutor = new ThreadPoolExecutor(
                    5,
                    10,
                    5,
                    TimeUnit.MINUTES,
                    new ArrayBlockingQueue<Runnable>(195));
        }
        return threadPoolExecutor;
    }
}
